package mvc.model.service.impl;

import mvc.common.RandomPass;
import mvc.model.dao.UserDao;
import mvc.model.dao.impl.UserDaoImpl;
import mvc.model.pojos.UserBean;
import mvc.model.service.SignService;

public class SignServiceImpl implements SignService {
    private final static UserDao userDao;
    static {
        userDao = new UserDaoImpl();
    }
    @Override
    public boolean checkUname(String uname) {
        UserBean userBean = userDao.queryOne(uname);
        return userBean == null;
    }

    @Override
    public boolean addUser(String uname) {
        UserBean userBean = new UserBean();
        userBean.setUname(uname);
        userBean.setUpass(RandomPass.getPass());
        userBean.setPhone(uname);
        return userDao.addUser(userBean);
    }
}
